package com.godyao.framework.core.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * 从系统文件加载资源
 * @author missw
 */
public class FileSystemResource implements Resource{
    private final File file;

    private final String filePath;

    public FileSystemResource(String filePath) {
        this.file = new File(filePath);
        this.filePath = filePath;
    }

    public FileSystemResource(File file) {
        this.file = file;
        this.filePath = file.getPath();
    }

    @Override
    public InputStream getInputStream() throws FileNotFoundException {
        return new FileInputStream(file);
    }


    public String getFilePath() {
        return filePath;
    }
}
